home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / external / rpc / example.c next >
Encoding:
C/C++ Source or Header  |  1997-07-08  |  1.1 KB  |  45 lines

  1. /*
  2.  * $Id: example.c,v 1.1 1997/01/29 23:25:54 kirk Exp $
  3.  */
  4. /*
  5.   Copyright (c) 1988-1997, Research Systems Inc.  All rights reserved.
  6.   This software includes information which is proprietary to and a
  7.   trade secret of Research Systems, Inc.  It is not to be disclosed
  8.   to anyone outside of this organization. Reproduction by any means
  9.   whatsoever is  prohibited without express written permission.
  10.  */
  11.  
  12. #include "idl_rpc.h"
  13.  
  14. int main()
  15. {
  16.    CLIENT *pClient;
  17.    char    cmdBuffer[512];
  18.    int     result;
  19.  
  20. /*
  21.  * Connect to the server.
  22.  */
  23.    if((pClient = IDL_RPCInit(0, (char*)NULL)) == (CLIENT*)NULL){
  24.       fprintf(stderr, "Can't register with IDL server\n");
  25.       exit(1);
  26.    }
  27. /*
  28.  * Start a loop that will read commands and then send them to idl.
  29.  */
  30.    for(;;){
  31.      printf("RMTIDL>");
  32.      cmdBuffer[0]='\0';
  33.      gets(cmdBuffer);
  34.      if( cmdBuffer[0] == '\n' || cmdBuffer[0] == '\0')
  35.         break;
  36.      result = IDL_RPCExecuteStr(pClient, cmdBuffer);
  37.    }
  38. /*
  39.  * Now disconnect from the server and kill it.
  40.  */
  41.    if(!IDL_RPCCleanup(pClient, 1))
  42.      fprintf(stderr, "IDL_RPCCleanup: failed\n");
  43.    exit(0);
  44. }
  45.